﻿package com.feizi.alipay;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000116670257";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCm/MLLtVbxND7kA5c1qNOjGq2NVGmSQ8Djgj+1+8Igb+BvhGm82+OAGU/0RIBbEPv46WJvY+cB7p5uQcFjJD6OIb4RR7PeXcHjl44eXNrQt9R6t70cYBRNJ8uX8W+jp5259tsd9yVXdn7RLgw+xdOKHMkFuhGdJUQjcAKveSzs6n3Je4ouJvpmpug8Bf2+7GROjCKPfumspOuRBK0293BuNzibxGxTyah5/MTNCtLU78cFJet3xYqj2NRryd78B/5lYMtACZWFFXJPXs57sarI5ookfb4VIMPpPKGJd0pB0q6CDFVODXOaJZ++xNKDHNCAR89LgVmakjxQvNfiMsUDAgMBAAECggEAX6TMaeMevh6/mtfXptthBL3GA/oCUc1O0MCMf06IvQ13TkhYS9ziLD/TRMRrhD1xJPt/7u8YpEmpItu0yXU8Ayqec8VO56Fp6VKoCwoCJqP0JqnQvkzls9+ERC38VI8vzxDuJfalw7fSITuvtdCXPjcIiKgvaIOsyGNilmDgc31VgchLYbz0TNIkLQkk1DrNlioKa4O14avPGObs+gaQe47jrnHeIIc9ymJpq1rXMdE9gVj21mjuKaTV6n+b3uMBK1NDi788755GmOcLxCgKd+Du7qLJzJu1MkS7d45JbpdCBMnu8H8h3CqRjFZXFZPYUD8xVqPHGyr4IPaCueONcQKBgQD/syVJcKT+Ug9rMh7trTC/LUwXeFOonUpxM9sVELXK7ni6YIpkQqB0cG0ye4FzXXfatat1wDMiZly623g7d04Pkr3rRrcKzHbMUB139Tk1yloCQfKwH0rw5CbRTfXc0nH3Qk6KksMiOlScARAqJvh7h9BiL+vanZJlO1VIaT/7ewKBgQCnLvORON1Pai+PNm2DDsTRsQtVuV+brIOhjaGxuzo60Fpt6LHjVQfMCuxluXnOWrgtp7RmmD/gDkU1jO0CD1QomVwEQYNQO/9fxx2txXe1maNu9gQZQFwtq67hw7jMc4bEVE3Gu3CaQcWPHuk5DWLBa6wZct8ed1B/X3N4XSDCGQKBgAeZr5YLPxxAHC03hCvUZgqIsiZQcUwlwLy0qeJqaLzrcbM4g2SPhm1vmg9SFHr1YEaj98C8QcjX+hGjzGMYHL3hwrtnkrFDepSAHSAfrd+ncB15EFmj1HpsjarTAmfZ6YFL+0GrMxmlWjZ44Z4fImupkcwZWI1a+asApHxOhJRZAoGBAJKfXeQ+T/InOaDLZk4rtLgHIt7C3jQEn8kfEvFyN8Z/FuAP1XuABn+QEPXCLi6pZ6A61b+oxVR2j4JAn1hQI0ob/hSJdGX4yKayVbgiWDO/lBNr1fpjdLRlPtInujotE8O6ACBMIZxYFLDJtldgAv2Jtfz3vvDUSZf8GaQ1YNZ5AoGBAMDtABOyjQq5HDQcXAogiFh8pUNRHAQSvqqL2dX7/x+c9clw/6GoyIyGltGYTT7boJAs5Uz3br0+4kzPC6HkSXxaOG5/CynxeYCmEl7dxk7aGhIeEmIvzsWFjseI5sgSnFgVPqEPvLPvBPfvJPWvhsLc5j7KWg+cauJ4J6I6FNcz";
    		
    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvk1fi4yC9BiigCz+CroxJghz2LZ8U/RHafSIf5StVLV/XC5C3bolBOFk6uO/XMWMgwnjJpS272lbYNGv0zWFCtdJp4+V9RAOjzoaH5huvCqzWUms5L5Nqs/zXl8AJtA5FqKOv76YgAF0aI1KvVHEo1osy3gZRmNWtsZeTTkP8jv6hKXQ+Ro2qbaw3fJmakWmgdNkcA9aDlOvfRjbdA0lr6iCpwKpvmGI+E8Wt+Ex7I7/PAxtexNZbBHuOcnyHo6j4Ttxo8baphULdLzvMTAYU3bKzV2GCFDH0HXNDESBRixjDvcRPpjs0MN3O5V32P+ZaViYWaBicpHWW9XHqIT9uwIDAQAB";
    
	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/feizi_web/notifyUrl.do";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/feizi_web/returnUrl.do";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

